﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 课程管理 <span class="c-gray en">&gt;</span> 课程列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" href="{:url('add')}">
				<i class="Hui-iconfont">&#xe600;</i> 新增课程
			</a>
		</span>
		<form class="form-inline" role="form" method="get">
			<div id="" class="" style="margin-left: 50px;margin-left: 250px;height: 10px;">
				<label>课程类型:
					<select  style="width:15%;" name="keywords" class="input-text" id="keywords">
						<option value="0"  style="width:60%;" {if $keywords==0} selected {/if}>请点击选择</option>
						<option value="1"  style="width:60%;" {if $keywords==1} selected {/if}>集体</option>
						<option value="2"  style="width:60%;" {if $keywords==2} selected {/if}>一对多</option>
						<option value="3" {if $keywords==3} selected {/if}  style="width:60%;">一对一</option>
					</select>
				<button class="btn btn-primary radius" type="submit" id="submit"  style="margin-top: -4px;">&nbsp;&nbsp;搜索&nbsp;&nbsp;</button>
					<button class="btn btn-warning radius" type="submit" id="reset"  style="margin-top: -4px;">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>
				</label>
			</div>
		</form>
		<span class="r">共有：<strong>{$total}</strong> 条</span>
	</div>

	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
			<tr class="text-c">
				<th width="60">课程编号</th>
				<th width="200">课程名称</th>
				<th width="80">课程类型</th>
				<th width="250">具体门店</th>
				<th width="250">操作</th>
			</tr>
			</thead>
			<tbody id="classesList">
			{foreach name="list" item="val" key="key"}
			<tr class="text-c">
				<td>{$val['course_id']}</td>
				<td>{$val['course_name']}</td>
				<td>
					{if condition="($val['course_type'] == 1) "}集体
					{elseif condition="$val['course_type'] ==2 "/}一对多
					{else /}一对一
					{/if}
				</td>
				<td>{$val['store_name']}</td>
				<td class="f-14 product-brand-manage" id="use">

					{if $val['is_arrange'] == 0 and $val['course_type']==1}
					<a class="label label-secondary radius" href="{:url('course_arrange/add',['course_id' => $val.course_id , 'store_id' => $val.store_id])}">智能排课</a>
					{elseif($val['course_type']==1)/}
					<a class="label label-danger radius" href="{:url('course_arrange/index',array('course_id'=>$val['course_id']))}">已排课</a>
					{/if}

					<a class="label label-secondary radius" href="{:url('edit',array('course_id'=>$val['course_id']))}" style="margin-left: 10px">点击编辑</a>
					{if $val['status'] == 0}
					<span class="label label-success radius" onClick="is_show('{$val.course_id}',1)" style="margin-left: 10px">点击闭课</span>
					{else /}
					<span class="label label-danger radius" onClick="is_show('{$val.course_id}',0)" style="margin-left: 10px">点击开课</span>
					{/if}
				</td>
			</tr>
			{/foreach}
			{if count($list)<=0 }
			<tr class="text-c">
				<td colspan="6">
					暂无数据
				</td>
			</tr>
			{/if}
			</tbody>
		</table>
	</div>
	{$page}
</div>

{include file="public:footer_js"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">

    function is_show(course_id,status) {
        var notice = "确定关闭吗？";
        if (status == 0){
            notice = "确定开启吗？";
        }else if(status === 1){
            notice = "确定关闭吗？";
        }
        //异步提交
        layer.confirm(notice,function (index) {
            $.ajax({
                type:"POST",
                url:"{:url('is_show')}",
                data:{
                    course_id : course_id,
                    status    : status
                },
                async:true,
                success:function (res) {
                    if(res.code === 1){
                        layer.msg(res.msg,{icon:6,time:1000});
                        //刷新可修改数据
                        setTimeout(function () {
                            location.replace(location.href);
                        },2000);

                    }else{
                        layer.msg(res.msg,{icon:5,time:1000});
                    }
                },
                error:function (res) {
                    console.log(res.data);
                }
            });
        })
    }
    //刷新
    $('#reset').click(function () {
        $('#keywords').val('');
    })
</script>
</body>
</html>